<template>
	<view class="toolBar-page">
		<view class="toolBarItem" v-for="(item,index) in toolBarData" :key="index" @click="goToolBar(item)">
			<view class="icon" :style="{ backgroundImage: 'url(' + item.icon + ')' }"></view>
			<view class="text">{{item.text}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				toolBarData: [{
					id: 1,
					text: "优惠券",
					icon: "/static/my/toolBar_1.png"
				}, {
					id: 2,
					text: "收藏",
					icon: "/static/my/toolBar_2.png"
				}, {
					id: 3,
					text: "余额",
					icon: "/static/my/toolBar_3.png"
				}, {
					id: 4,
					text: "浏览记录",
					icon: "/static/my/toolBar_4.png"
				}]
			}
		},
		methods: {
			goToolBar(item) {
				if (item.id == 1) {
					uni.navigateTo({
						url: "/pages/mys/preferential/preferential"
					})
				}
				if (item.id == 2) {
					uni.navigateTo({
						url: "/pages/mys/collection/collection"
					})
				}
				if (item.id == 3) {
					uni.navigateTo({
						url: "/pages/mys/gold/gold"
					})
				}
				if (item.id == 4) {
					uni.navigateTo({
						url: ""
					})
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.toolBar-page {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: space-between;

		.toolBarItem {
			width: 120rpx;
			height: 130rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: space-around;

			.icon {
				width: 60rpx;
				height: 60rpx;
				background-size: contain;
				background-position: center;
				background-repeat: no-repeat;
			}

			.text {
				width: 100%;
				font-size: 28rpx;
				text-align: center;
			}
		}

	}
</style>